package com.emergency.db.dao.staff;


import com.emergency.db.domain.staff.StaffDose;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface StaffDoseDao extends JpaRepository<StaffDose, Long>, JpaSpecificationExecutor<StaffDose> {
    @Modifying
    @Query(value = "delete FROM bas_staff_dose WHERE staff_id = ? ", nativeQuery = true)
    void deleteAllByStaff(Long id);

    @Query(value = "select * from bas_staff_dose where staff_id= ? ", nativeQuery = true)
    Page<StaffDose> findAllByStaff(@Param("id") Long id, Pageable p);
}
